<script setup>
import PostItem from "../components/PostItem.vue";
import PostList from "../components/PostList.vue";
import PostDetail from "../components/PostDetail.vue";
import PostUpload from "../components/PostUpload.vue";
import { useStore } from "vuex";
import { computed, ref, onMounted } from "vue";

const store = useStore();
9;
const showUploadVal = computed(() => {
  return store.state.showUpload;
});

const showPostDetail = computed(() => {
  return store.state.showPostDetail;
});

onMounted(() => {
  // setTimeout(() => {
  //   store.commit("changePostDetail", true);
  // }, 2000);
});

//处理显示帖子

const postList = computed(() => {
  return store.state.post.originFiles;
});
</script>
<template>
  <div>
    <PostList>
      <PostItem v-for="item in postList" :post="item"></PostItem>
    </PostList>
    <PostDetail v-if="showPostDetail"></PostDetail>
    <PostUpload v-if="showUploadVal"></PostUpload>
  </div>
</template>

<style scoped></style>
